import { _decorator, Button } from 'cc';
import { BasePanel } from '../../../../scripts/libs/ui/BasePanel';
import { BindButton } from '../../../../scripts/libs/rxjs/cc3/BindButton';
import { game002 } from '../../Game002Manager';
const { ccclass, property } = _decorator;

@ccclass('DialogPanel')
export class DialogPanel extends BasePanel {

    @property(Button)
    okButton: Button = null;

    @property(Button)
    cancelButton: Button = null;

    useObserves() {
        return [
            BindButton(this.okButton).subscribe(this.okButtonClicked.bind(this)),
            BindButton(this.cancelButton).subscribe(this.cancelButtonClicked.bind(this))
        ];
    }

    okButtonClicked() {
        this.log('okButtonClicked');
        DialogPanel.CloseProcess(null, { result: 'ok' }, null, game002.uiRoot);
    }

    cancelButtonClicked() {
        this.log('cancelButtonClicked');
        DialogPanel.CloseProcess(null, { result: 'cancel' }, null, game002.uiRoot);

    }
}

